<!-- 
@Description: 个人中心
@Author: fcg 
-->
<template>
	<view class="personal">

		<view class="top">

			<cg-navbar title="我的" bgColor="transparent"></cg-navbar>
			<view class="userinfo cg-align-center">
				<cg-image shape="circle" width="84rpx" height="84rpx" :src="$userInfo.avatar" type="cdn"></cg-image>
				
				<template >
					<view class="phone">
						用户：{{$userInfo.userName || ''}}
					</view>
				</template>

			</view>
			<view class="money-box round">
				
				
			</view>
		</view>
		<view class="menu">
			<view class="menu-item cg-align-center cg-space-between round" v-for="(item,index) in menuList" :key="index"
				@click="toPage(item)">
				<view class="cg-align-center">
					<u-icon :name="item.icon"></u-icon>
					<view class="menu-title">
						{{item.title}}
					</view>
				</view>
				<view class="cg-align-center">
					<view class="des" v-if="item.des">
						{{item.des}}
					</view>
					<view class="refresh" v-if="item.refresh">
						<cg-image src="/icon/refresh.png" width="37rpx" height="37rpx"></cg-image>
					</view>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>
		<view class="logout">
			<u-button text="退出登录" @click="logout"></u-button>
		</view>
		<cg-custom-alert></cg-custom-alert>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				page: 1,
				status: 'loading',
			}
		},
		computed: {
			menuList() {
				return [ {
					title: '设置',
					icon: 'setting',
					path: '/pages/personal/setting/index'
				}]
			}
		},
		async onShow() {
			await this.$getConfig;
			this.$store.dispatch('updateUserInfo', {
				force: true
			})
		},

		methods: {
			toPage(item) {
				this.$CGRouter.push(item.path)
			},
			logout() {
				this.$dialog.confirm('确认要退出登录吗').then(() => {
					this.$store.dispatch('logout')
				})

			},

		},


	}
</script>

<style lang="scss" scoped>
	.bg {
		position: fixed;
		left: 0;
		width: 100%;
	}

	.round {
		background: #FFFFFF;
		border-radius: 16rpx;
	}
	.top {
		background-color: $themeColor;
	}
	.personal {
		

		.userinfo {
			padding: 60rpx 0;
			z-index: 100;
			position: relative;
			color: #FFFFFF;

			.phone {
				margin-left: 15rpx;
				font-size: 30rpx;

			}
		}
	}

	.btn {
		width: 154rpx;
		height: 54rpx;
		border-radius: 31rpx;
		border: 2rpx solid #FFFFFF;
		color: #FFFFFF;
		@include flexCenter;
	}

	.money-box {
		position: relative;
		padding: 25rpx 0;

		.money-box-top {
			border-bottom: 1rpx solid #EEEEEE;
			padding: 0 30rpx;
			padding-bottom: 30rpx;

			.money {
				color: #FF5C04;
				font-size: 52rpx;
				margin-left: 20rpx;
			}

			.btn {
				height: 54rpx;
				width: 154rpx;
			}
		}

		.money-box-bottom {
			padding: 0 30rpx;
			padding-top: 20rpx;
		}
	}

	.menu {
		.menu-item {
			margin-top: 20rpx;
			padding: 25rpx 20rpx;

			.menu-title {
				margin-left: 30rpx;
			}

			.des,
			.refresh {
				margin-right: 15rpx;
				color: #B3B3B3;
				font-size: 26rpx;
			}
		}
	}

	.logout {
		margin-top: 40rpx;
	}
</style>